<%--
  Created by IntelliJ IDEA.
  User: jqy
  Date: 2023/12/9
  Time: 17:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.*" %>
<%@ page import="cn.sqlexperiment.web.classes.CaseData" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="cn.sqlexperiment.web.servlet.Page" %>

<html>
<head>
    <title>student</title>
    <style>
        .box {
            width: 1000px;
            height: 600px;
            flex-shrink: 0;
            /* 超出部分隐藏 */
            overflow: hidden;
            margin: auto;
            display: flex;
            background-color: #E1E9EF;
        }


        .table11_3{
            width: 1000px;
            height: 600px;
        }
        .table11_3 table {
            margin:40px 20px;
            border:0;
        }
        .table11_3 th {
            background-color:#FF5675;
            color:#FFFFFF
        }
        .table11_3,.table11_3 th,.table11_3 td {
            font-size:0.95em;
            text-align:center;
            padding:4px;
            border-collapse:collapse;
        }
        .table11_3 th,.table11_3 td {
            border: 1px solid #fe2047;
            border-width:1px 0 1px 0;
            border:2px inset #ffffff;
        }
        .table11_3 tr {
            border: 1px solid #ffffff;
        }
        .table11_3 tr:nth-child(odd){
            background-color:#fec6d1;
        }
        .table11_3 tr:nth-child(even){
            background-color:#ffffff;
        }
    </style>
</head>
<body>
<%
    List<CaseData> productList = new ArrayList<>();
    productList = (List) request.getAttribute("products");
    Page pages = (Page) request.getAttribute("page");
%>
<div class="box">
    <table border="1" class=table11_3>
        <tr>
            <td>病历号</td>
            <td>患者姓名</td>
            <td>患者身份证号</td>
            <td>创建时间</td>
            <td>诊断结果</td>
            <td>录入诊断结果</td>
            <td>查询处方信息</td>
        </tr>
        <%
            if (productList != null) {
                int i=0;
                for (CaseData product : productList) {
                    i++;
        %>
        <tr>
            <td><%=product.getCaseno()%>
            </td>
            <td><%=product.getName()%>
            </td>
            <td><%=product.getPatino().split(",")[0]%>
            </td>
            <td><%=product.getTime()%>
            </td>
            <td><%=product.getResult()%>
            </td>
            <td>
                <%
                    if (pages.getPageIndex() >= pages.getTotalPages() && i==productList.size()) {
                %>
                <form action="recordresult.jsp" method="post">
                <input type="text" name="name" style="display:none" value="<%=product.getName()%>">
                <input type="text" name="caseno" style="display:none" value="<%=product.getCaseno()%>">
                <input type="text" name="patino" style="display:none" value="<%=product.getPatino().split(",")[0]%>">
                <input type="text" name="time" style="display:none" value="<%=product.getTime()%>">
                <input type="text" name="result" style="display:none" value="<%=product.getResult()%>">
                <input type="submit" value="录入本次诊断结果">
                </form>
                <%
                    }else
                    {
                %>
                    <label>不可编辑本次病历</label>
                <%
                    }
                %>
            </td>
            <td>
                <form action="/_war_exploded/ShowPrescripServlet" method="post">
                    <input type="text" name="caseno" style="display:none" value="<%=product.getCaseno()%>">
                    <input type="text" name="patino" style="display:none" value="<%=product.getPatino().split(",")[0]%>">
                    <input type="submit" value="查询处方信息">
                </form>
            </td>
        </tr>
        <%
                }
            }
        %>
        <tr>
            <td colspan="7">
                <a href="/_war_exploded/ShowCaseServlet?pageIndex=1&docno=<%=productList.get(0).getPatino().split(",")[1]%>&Patiname=<%=productList.get(0).getName()%>">首页</a>&nbsp;
                <%
                    if (pages.getPageIndex() > 1) {
                %>
                <a href="/_war_exploded/ShowCaseServlet?pageIndex=${page.pageIndex - 1}&docno=<%=productList.get(0).getPatino().split(",")[1]%>&Patiname=<%=productList.get(0).getName()%>">上一页</a>&nbsp;
                <%
                    }
                    if (pages.getPageIndex() < pages.getTotalPages()) {
                %>
                <a href="/_war_exploded/ShowCaseServlet?pageIndex=${page.pageIndex + 1}&docno=<%=productList.get(0).getPatino().split(",")[1]%>&Patiname=<%=productList.get(0).getName()%>">下一页</a>&nbsp;
                <%
                    }
                %>
                <a href="/_war_exploded/ShowCaseServlet?pageIndex=${page.totalPages}&docno=<%=productList.get(0).getPatino().split(",")[1]%>&Patiname=<%=productList.get(0).getName()%>">尾页</a>&nbsp;
            </td>
        </tr>
    </table>
</div>
</body>
</html>

